home *** CD-ROM | disk | FTP | other *** search
/ Mac Magazin/MacEasy 11 / Mac Magazin and MacEasy Magazine CD - Issue 11.iso / Sharewarebibliothek / Entwickler / WASTE 1.1 C / WASTEIntf.h < prev    next >
Text File  |  1995-05-19  |  53KB  |  1,201 lines

  1. /*
  2. // { WASTE PROJECT: }
  3. // { Internal interface: constants, types and inline code }
  4.  
  5. // { Copyright © 1993-1995 Marco Piovanelli }
  6. // { All Rights Reserved }
  7. */
  8.  
  9. #ifndef __LONGCOORDINATES__
  10. #ifndef _LongCoords_
  11. #include "LongCoords.h"
  12. #endif
  13. #endif
  14.  
  15. /*    useful macros for testing, setting and clearing bits */
  16.  
  17. #include <TextEdit.h>
  18. #include <Scrap.h>
  19. #include <TextServices.h>
  20. #include <Script.h>
  21. #include <ToolUtils.h>
  22. #include <TextUtils.h>
  23. #include <LowMem.h>
  24. #include <AERegistry.h>
  25. #include <Drag.h>
  26.  
  27. #define BTST( FLAGS, BIT )    (((FLAGS) & (1L << (BIT))) ? 1 : 0)
  28. #define BSET( FLAGS, BIT )  ((FLAGS) |= (1L << (BIT)))
  29. #define BCLR( FLAGS, BIT )  ((FLAGS) &= (~(1L << (BIT))))
  30.  
  31. #define ABS(A) ((A) > 0 ? (A) : -(A))
  32.  
  33. #define BSL(A, B)    (((long)A) << (B))
  34. #define BSR(A, B)    (((long)A) >> (B))
  35.  
  36. // if WEREDRAW_SPEED is defined, Mark Alldritt's optimizations of _WERedraw are used
  37. //#define WEREDRAW_SPEED        1
  38.  
  39. // if WEPINSCROLL is defined, Chris Thomas's modifications are used to make WEScroll()
  40. // behave like TEPinScroll()
  41. //#define WEPINSCROLL            1
  42.  
  43. // Don't let WASTE synchronize keyboard and fonts
  44. //#define WASTENOSYNCH        1
  45.  
  46. // if WESMARTRECALCSLOP is defined, Leonard Rosenthol's improvements to only bother
  47. // recalculating each line's slop value when justification changes to weJustify
  48. // is enabled
  49. //#define WESMARTRECALCSLOP    1
  50.  
  51. // if WEFORCE_2BYTE is defined, weFDoubleByte is always defined
  52. // this is to work around a bug in JLK and CLK 1.1.1 which incorrectly
  53. // says there are no double byte scripts in PPC native code
  54. //#define WEFORCE_2BYTE    1
  55.  
  56. // if WASTE_DEBUG is defined various asserts are done.  If they
  57. // fail, an error will be reported with DebugStr
  58. // #define WASTE_DEBUG
  59.  
  60. // if WASTE_NO_RO_CARET is defined, the caret will not be shown if it is read-only
  61. //#define WASTE_NO_RO_CARET    1
  62.  
  63. // if WASTE_IC is defined, cmd-clicking URL's is supported through Internet Config
  64. // #define WASTE_IC
  65.  
  66. #include "LongCoords.h"
  67. #include <limits.h>
  68.  
  69. /* result codes */
  70. enum {
  71.     weCantUndoErr                =    -10015,    /* undo buffer is clear (= errAECantUndo) */
  72.     weEmptySelectionErr            =    -10013,    /* selection range is empty (= errAENoUserSelection) */
  73.     weUnknownObjectTypeErr        =    -9478,    /* specified object type is not registered */
  74.     weObjectNotFoundErr            =    -9477,    /* no object found at specified offset */
  75.     weReadOnlyErr                =    -9476    /* instance is read-only */
  76. };
  77.  
  78. // { values for WEInstallObjectHandler handlerSelector parameter }
  79. enum {
  80.         weNewHandler = 'new ',
  81.         weDisposeHandler = 'free',
  82.         weDrawHandler = 'draw',
  83.         weClickHandler = 'clik',
  84.         weCursorHandler = 'curs'
  85. };
  86.  
  87. /*    action kinds */
  88.  
  89. enum {
  90.     weAKNone            =    0,        /* null action */
  91.     weAKUnspecified        =    1,        /* action of unspecified nature */
  92.     weAKTyping            =    2,        /* some text has been typed in */
  93.     weAKCut                =    3,        /* the selection range has been cut */
  94.     weAKPaste            =    4,        /* something has been pasted */
  95.     weAKClear            =    5,        /* the selection range has been deleted */
  96.     weAKDrag            =    6,        /* drag and drop operation */
  97.     weAKSetStyle        =    7        /* some style has been applied to a text range */
  98. };
  99.  
  100. /* action flags */
  101.  
  102. enum {
  103.     weAFIsRedo            =    0x0001,    // action saves edit state prior to a WEUndo call
  104.     weAFDontSaveText    =    0x0002, // don't save text
  105.     weAFDontSaveStyles    =    0x0004,    // don't save styles
  106.     weAFDontSaveSoup    =    0x0008
  107. };
  108.  
  109. typedef short WEActionKind;
  110. typedef short WEActionFlags;
  111.  
  112. /*    alignment styles */
  113.  
  114. enum {
  115.     weFlushLeft         =    -2,        /* flush left */
  116.     weFlushRight        =    -1,        /* flush right */
  117.     weFlushDefault        =     0,        /* flush according to system direction */
  118.     weCenter            =     1,        /* centered */
  119.     weJustify            =     2        /* fully justified */
  120. };
  121.  
  122. // { values for the edge parameter }
  123.  
  124. enum {
  125.     kLeadingEdge = -1,            // { point is on the leading edge of a glyph }
  126.     kTrailingEdge = 0,            // { point is on the trailing edge of a glyph }
  127.     kObjectEdge = 2                // { point is inside an embedded object }
  128. };
  129.  
  130. // { control character codes }
  131.  
  132. enum {
  133.     kObjectMarker = 1,
  134.     kBackspace = 8,
  135.     kTab = 9,
  136.     kEOL = 13,
  137.     kSpace = 32,
  138.     kArrowLeft = 28,
  139.     kArrowRight = 29,
  140.     kArrowUp = 30,
  141.     kArrowDown = 31,
  142.     kForwardDelete =127
  143. };
  144.  
  145. // { bit equates for QuickDraw styles }
  146.  
  147. enum {
  148.     tsBold = 0,
  149.     tsItalic = 1,
  150.     tsUnderline = 2,
  151.     tsOutline = 3,
  152.     tsShadow = 4,
  153.     tsCondense = 5,
  154.     tsExtend = 6
  155. };
  156.  
  157. // { bit equates for the tsFlags field of the WETextStyle record }
  158. enum {
  159.     tsTSMHilite = 4,                        // { set if style run is part of active input area }
  160.     tsTSMSelected = 5,                        // { set for selected raw/converted text }
  161.     tsTSMConverted = 6,                        // { set for converted text, clear for raw text }
  162.     tsRightToLeft = 7                        // { reserved for future use }
  163. };
  164.  
  165. // { bit equates for the mode parameter in WESetStyle and WEContinuousStyle }
  166. enum {
  167.     kModeFont = 0,
  168.     kModeFace = 1,
  169.     kModeSize = 2,
  170.     kModeColor = 3,
  171.     kModeAddSize = 4,
  172.     kModeToggleFace = 5,
  173.     kModeReplaceFace = 6,
  174.     kModeObject = 14,
  175.     kModeFlags = 15
  176. };
  177.  
  178. // { values for the mode parameter in WESetStyle and WEContinuousStyle }
  179. enum {
  180.     weDoFont            =    0x0001,
  181.     weDoFace            =    0x0002,
  182.     weDoSize            =    0x0004,
  183.     weDoColor            =    0x0008,
  184.     weDoAll                =    weDoFont + weDoFace + weDoSize + weDoColor,
  185.     weDoAddSize            =    0x0010,
  186.     weDoToggleFace        =    0x0020,
  187.     weDoReplaceFace        =    0x0040,
  188.     weDoObject            =    0x4000,
  189.     weDoFlags            =    0x8000
  190. };
  191.  
  192. // { values for WEFeatureFlag action parameter }
  193. enum {
  194.     weBitClear = 0,                                // { disables the specified feature }
  195.     weBitSet = 1,                                // { enables the specified feature }
  196.     weBitTest = -1,                                // { returns the current setting of the specified feature }
  197.     weBitToggle = -2                            // { toggles the specified feature }
  198. };
  199.  
  200. // { bit equates for the flags field in the WE record }
  201. // { bits 0..15 can be used to turn on and off specific features with WEFeatureFlag }
  202. // { bits 16..31 are used internally and should not be modified }
  203.  
  204. // { private flags }
  205. enum {
  206.     weFHasColorQD = 31,                        // { Color QuickDraw is available }
  207.     weFHasTextServices = 30,                // { Text Services Manager is available }
  208.     weFNonRoman = 29,                        // { at least one non-Roman script is enabled }
  209.     weFDoubleByte = 28,                        // { a double-byte script is installed }
  210.     weFWorldScript = 27,                    // { TRUE if Script Manager 7.1 or newer is available }
  211.     weFCaretVisible = 24,                    // { the caret is currently visible }
  212.     weFMouseTracking = 23,                    // { set internally during mouse tracking }
  213.     weFAnchorIsEnd = 22,                    // { anchor offset is selEnd }
  214.     weFUseNullStyle = 21,                    // { a null style is associated with the empty selection }
  215.     weFActive = 20,                            // { we're active }
  216.     weFHilited = 19,                        // { TRUE if text pane is highlighted (for Drag & Drop) }
  217.     weFCanAcceptDrag = 18,                    // { The drag in the text pane can be accepted }
  218.     weFDragCaretVisible = 17                // { Drag caret is currently visible }
  219. };
  220.  
  221. // { public flags }
  222. enum {
  223.     weFDrawOffscreen = 11,                    // { draw text offscreen for smoother visual results }
  224.     weFUseTempMem = 10,                        // { use temporary memory for main data structures }
  225.     weFInhibitRecal = 9,                    // { if set, recals and redraws are inhibited }
  226.     weFDragAndDrop = 8,                        // { Text drag-and-drop }
  227.     weFIntCutAndPaste = 7,                    // { Intelligent Cut & Paste }
  228.     weFUndoSupport = 6,                        // { Support Undo/Redo }
  229.     weFReadOnly = 5,                        // { Disallow editing }
  230.     weFOutlineHilite = 2,                    // { frame selection range when text pane is inactive }
  231.     weFAutoScroll = 0                        // { automatically scroll text when cursor is outside pane }
  232. };
  233.  
  234. // { masks for setting the feature bits }
  235. enum {
  236.     weDoAutoScroll = 1 << weFAutoScroll,
  237.     weDoOutlineHilite = 1 << weFOutlineHilite,
  238.     weDoReadOnly = 1 << weFReadOnly,
  239.     weDoUndoSupport = 1 << weFUndoSupport,
  240.     weDoIntCutAndPaste = 1 << weFIntCutAndPaste,
  241.     weDoDragAndDrop = 1 << weFDragAndDrop,
  242.     weDoInhibitRecal =  1 << weFInhibitRecal,
  243.     weDoUseTempMem = 1 << weFUseTempMem,
  244.     weDoDrawOffscreen = 1 << weFDrawOffscreen 
  245. };
  246.  
  247. // { scrap types }
  248. enum {
  249.     kTypeText = 'TEXT',
  250.     kTypeStyles = 'styl',
  251.     kTypePicture = 'PICT',
  252.     kTypeSoup = 'SOUP'
  253. };
  254.  
  255. // { selectors for WEGetInfo/WESetInfo }
  256. enum {
  257.     weCharByteHook = 'cbyt',
  258.     weCharTypeHook = 'ctyp',
  259.     weCharToPixelHook = 'c2p ',
  260.     weClickLoop = 'clik',
  261.     weCurrentDrag = 'drag',
  262.     weDrawTextHook = 'draw',
  263.     weLineArray = 'line',
  264.     weLineBreakHook = 'lbrk',
  265.     wePixelToCharHook = 'p2c ',
  266.     wePort = 'port',
  267.     weRefCon = 'refc',
  268.     weRunArray = 'runa',
  269.     weScrollProc = 'scrl',
  270.     weStyleTable = 'styl',
  271.     weText = 'text',
  272.     weTranslateDragHook = 'xdrg',
  273.     weTSMDocumentID = 'tsmd',
  274.     weTSMPostUpdate = 'post',
  275.     weTSMPreUpdate = 'pre '
  276. };
  277.  
  278. // { possible values returned by WEIntelligentPaste }
  279. enum {
  280.     weDontAddSpaces = 0,
  281.     weAddSpaceOnLeftSide = -1,
  282.     weAddSpaceOnRightSide = 1
  283. };
  284.  
  285. // { values for WEAllocate allocFlags parameter }
  286. enum {
  287.     kAllocClear = 0x0001,                        // { clear handle after allocation }
  288.     kAllocTemp = 0x0002                        // { use temporary memory if available }
  289. };
  290.  
  291. // { other miscellaneous constants }
  292. enum {
  293.     kCaretWidth = 1,                    // { width of the caret, in pixels }
  294.     kMinFontSize = 1,                    // { minimum valid font size }
  295.     kMaxFontSize = SHRT_MAX,            // { maximum valid font size }
  296.     kInvalidOffset = -1,                 // { used to flag an invalid or nonexistent offset }
  297.     kNullDrag = 0,                        // { null or nonexistent drag reference }
  298.     kNullObject = 0                        // { null object reference }
  299. };
  300.  
  301. // from WEMouse.c
  302. enum {
  303.     noDragErr = 128,
  304.     kTextMargin = 3,        // { width of border area surrounding the text (in pixels) }
  305.     kAutoScrollDelay = 10    // { delay before auto-scroll starts (in ticks) }
  306. };
  307.  
  308.  
  309. // static long kOneToOneScaling = 0x00010001;        // { 1:1 scaling ratio }
  310. static Point kOneToOneScaling = {1, 1}; // { 1:1 scaling ratio }
  311.  
  312. // { WETextStyle is just a familiar TextStyle record as defined by TextEdit, where }
  313. // { tsFace is redefined as SignedByte (rather than Style) so that the filler byte }
  314. // { becomes "visible" from Pascal and can be used to store internal flags }
  315.  
  316. #if defined(powerc) || defined (__powerc)
  317. #pragma options align=mac68k
  318. #endif
  319.  
  320. typedef struct WETextStyle {
  321.     short tsFont;                /* font family number */
  322.     char tsFace;                /* set of QuickDraw styles */
  323.     char tsFlags;                /* flags (FOR INTERNAL USE ONLY) */
  324.     short tsSize;                /* font size, in integer points */
  325.     RGBColor tsColor;            /* absolute red-green-blue color */
  326.     long tsObject;            // { embedded object reference }
  327. } WETextStyle, *WETextStylePtr, **WETextStyleHandle;
  328.  
  329. typedef struct WERunAttributes {
  330.     short runHeight;            /* style run height (ascent + descent + leading) */
  331.     short runAscent;            /* font ascent */
  332.     WETextStyle runStyle;        /* text style */
  333. } WERunAttributes, *WERunAttributesPtr, **WERunAttributesHandle;
  334.  
  335. typedef struct WERunInfo {
  336.     long runStart;                /* byte offset to first character of this style run */
  337.     long runEnd;                /* byte offset to first character of next style run */
  338.     WERunAttributes runAttrs;    /* run attributes */
  339. } WERunInfo, *WERunInfoPtr, **WERunInfoHandle;
  340.  
  341. typedef struct WEStyleScrapElement {
  342.     long scrpStartChar;
  343.     WERunAttributes scrpAttrs;
  344. } WEStyleScrapElement, *WEStyleScrapElementPtr, **WEStyleScrapElementHandle;
  345.  
  346. // { another "view" for the familiar TextEdit 'styl' Clipboard type }
  347. /*
  348. typedef struct WEStyleScrap {
  349.     short scrpNStyles;
  350.     WEStyleScrapElement scrpStyleTab[1];
  351. } WEStyleScrap, *WEStyleScrapPtr, **WEStyleScrapHandle;
  352. */
  353. // { the purpose of the GrafPort1 declaration is to redefine the txFace field as SignedByte, }
  354. // { rather than Style ( = set of StyleItem), to avoid using THINK Pascal runtime routines }
  355. // { for set manipulation }
  356.  
  357. typedef struct GrafPort1
  358. {
  359.     short                        device;
  360.     BitMap                        portBits;
  361.     Rect                        portRect;
  362.     RgnHandle                    visRgn;
  363.     RgnHandle                    clipRgn;
  364.     Pattern                        bkPat;
  365.     Pattern                        fillPat;
  366.     Point                        pnLoc;
  367.     Point                        pnSize;
  368.     short                        pnMode;
  369.     Pattern                        pnPat;
  370.     short                        pnVis;
  371.     short                        txFont;
  372.     char                        txFace;
  373.     char                        filler;
  374.     short                        txMode;
  375.     short                        txSize;
  376.     Fixed                        spExtra;
  377.     long                        fgColor;
  378.     long                        bkColor;
  379.     short                        colrBit;
  380.     short                        patStretch;
  381.     Handle                        picSave;
  382.     Handle                        rgnSave;
  383.     Handle                        polySave;
  384.     QDProcsPtr                    grafProcs;
  385. } GrafPort1, *GrafPtr1;
  386.  
  387. typedef struct QDEnvironment {
  388.     GrafPtr envPort;
  389.     PenState envPen;
  390.     WETextStyle envStyle;
  391.     short envMode;
  392. } QDEnvironment;
  393.  
  394. typedef struct RunArrayElement {
  395.     long runStart;                        // { offset to first character in style run }
  396.     long styleIndex;                    // { index into style table (high word currently unused) }
  397. } RunArrayElement, *RunArrayElementPtr, **RunArrayElementHandle;
  398.  
  399. typedef struct RunArrayPair {
  400.     RunArrayElement first;
  401.     RunArrayElement second;
  402. } RunArrayPair, *RunArrayPeek;
  403.  
  404. typedef struct TERunAttributes {
  405.     short runHeight;
  406.     short runAscent;
  407.     TextStyle runTEStyle;
  408. } TERunAttributes, *TERunAttributesPtr;
  409.  
  410. typedef struct TEStyleScrapElement {
  411.     long scrpStartChar;
  412.     TERunAttributes scrpTEAttrs;
  413. } TEStyleScrapElement, *TEStyleScrapElementPtr;
  414.  
  415. typedef struct TEStyleScrap {
  416.     short scrpNStyles;
  417.     TEStyleScrapElement scrpStyleTab[1];
  418. } TEStyleScrap, *TEStyleScrapPtr, **TEStyleScrapHandle;
  419.  
  420. typedef struct TEStyleScrapPair {
  421.     TEStyleScrapElement first;
  422.     TEStyleScrapElement second;
  423. } TEStyleScrapPair, *TEStyleScrapPeek;
  424.  
  425.  
  426. // const kRunArrayMaxIndex = (maxLong / sizeOf(RunArrayElement)) - 1;
  427.  
  428. typedef RunArrayElement *RunArrayPtr;
  429. typedef RunArrayPtr *RunArrayHandle;
  430.  
  431. typedef struct StyleTableElement {
  432.     long refCount;                    // { reference count }
  433.     WERunAttributes info;            // { style information }
  434. } StyleTableElement, *StyleTableElementPtr, **StyleTableElementHandle;
  435.  
  436. //        kStyleTableMaxIndex = (maxint div SizeOf(StyleTableElement)) - 1;
  437.  
  438. typedef StyleTableElement *StyleTablePtr;
  439. typedef StyleTablePtr *StyleTableHandle;
  440.  
  441. typedef struct LineRec {
  442.     long lineStart;                /* byte offset to first character in line */
  443.     long lineOrigin;            /* pixel offset from destRect.top */
  444.     short lineAscent;            /* maximum font ascent for this line */
  445.     short lineSlop;                /* extra pixels needed to fill up the line */
  446.     Fixed lineJustAmount;        /* normalized slop value, used for justification */
  447. } LineRec, *LinePtr, **LineHandle;
  448.  
  449.  
  450. typedef struct LinePair {
  451.     LineRec first;
  452.     LineRec second;
  453. } LinePair, *LinePeek;
  454.  
  455. //        kLineArrayMaxIndex = (maxLongInt div SizeOf(LineRec)) - 1;
  456.  
  457. typedef LineRec *LineArrayPtr;
  458. typedef LineArrayPtr *LineArrayHandle;
  459.  
  460. typedef struct    WERec {
  461.     GrafPtr port;                /* graphics port text is drawn into */
  462.     Handle hText;                /* handle to the text */
  463.     LineArrayHandle hLines;        /* handle to the line array */
  464.     StyleTableHandle hStyles;    /* handle to the style table */
  465.     RunArrayHandle hRuns;        /* handle to the style run array */
  466.     long textLength;            /* length of text */
  467.     long nLines;                /* number of lines */
  468.     long nStyles;                /* number of unique styles in the style table */
  469.     long nRuns;                    /* number of style runs */
  470.     LongRect viewRect;            /* view rectangle, all drawing is clipped to this */
  471.     LongRect destRect;            /* destination rectangle */
  472.     long selStart;                /* start of selection range */
  473.     long selEnd;                /* end of selection range */
  474.     long flags;                    /* 32 bits of miscellaneous flags */
  475.     long caretTime;                /* time of most recent caret drawing, in ticks */
  476.     long clickTime;                /* time of most recent click, in ticks */
  477.     long clickLoc;                /* byte offset of most recent click */
  478.     long anchorStart;            /* start offset of anchor word/line */
  479.     long anchorEnd;                /* end offset of anchor word/line */
  480.     UniversalProcPtr clickLoop;    /* click loop callback */
  481.     char unused1;                /* unused */
  482.     char clickEdge;                /* edge of character hit by most recent click */
  483.     char unused2;                /* unused */
  484.     char firstByte;                /* first byte of a double-byte character */
  485.     GrafPtr offscreenPort;        /* offscreen graphics world */
  486.     RgnHandle viewRgn;            /* handle to the view region */
  487.     UniversalProcPtr scrollProc;        /* scroll callback */
  488.     short clickCount;            /* multiple click count */    
  489.     char alignment;                /* alignment style */
  490.     long refCon;                /* reference value for client use */
  491.     TSMDocumentID tsmReference;    /* reference value for the text services manager */
  492.     long tsmAreaStart;            /* start of active input area (for TSM) */
  493.     long tsmAreaEnd;            /* end of active input area */
  494.     UniversalProcPtr tsmPreUpdate;        /* TSM pre-update callback */
  495.     UniversalProcPtr tsmPostUpdate;    /* TSM post-update callback */
  496.     DragReference currentDrag;    /* refereence of drag being tracked by _WEDrag */
  497.     long dragCaretOffset;        /* offset to caret displayed during a drag */
  498.     UniversalProcPtr translateDragHook;    /* drag translation hook */
  499.     Handle hActionStack;        /* action stack for undo */
  500.     long modCount;                /* modification count */
  501.     UniversalProcPtr drawTextHook;        // { hook for drawing text }
  502.     UniversalProcPtr pixelToCharHook;    // { hook for hit-testing }
  503.     UniversalProcPtr charToPixelHook;    // { hook for locating glyph position }
  504.     UniversalProcPtr lineBreakHook;        // { hook for finding line breaks }
  505.     UniversalProcPtr wordBreakHook;        // { hook for finding word breaks }
  506.     UniversalProcPtr charByteHook;        // { hook for finding character byte type }
  507.     UniversalProcPtr charTypeHook;        // { hook for finding character type }
  508.     Handle hObjectHandlerTable;    // { handle to object handler table for this instance }
  509.     WERunAttributes nullStyle;    /* style for null selection */
  510. } WERec, *WEPtr, **WEHandle;
  511.  
  512.  
  513. typedef struct WEAction {
  514.     WEHandle hOwner;            // handle to associated WE instance
  515.     struct WEAction **hNext;    // used to keep a linked list of actions
  516.     Handle hText;                // handle to saved text
  517.     Handle hStyles;                // handle to saved styles
  518.     Handle hSoup;                // handle to saved "soup"
  519.     long delRangeStart;            // start of range to delete
  520.     long delRangeLength;        // length of range to delete
  521.     long insRangeLength;        // lenfth of range to insert
  522.     long hiliteStart;            // start of range to hilite
  523.     long hiliteEnd;                // end of range to hilite
  524.     WEActionKind actionKind;    // identifies event that caused this action to be pushed
  525.     WEActionFlags actionFlags;    // miscellaneous flags
  526. } WEAction, *WEActionPtr, **WEActionHandle;
  527.  
  528. typedef struct WEObjectDesc {
  529.     OSType objectType;            // { 4-letter tag identifying object type }
  530.     Handle objectDataHandle;    // { handle to object data }
  531.     Point objectSize;            // { object height and width, in pixels }
  532.     Handle objectTable;            // { handle to object handler table }
  533.     short objectIndex;            // { index into object handler table (USED INTERNALLY) }
  534.     WEHandle objectOwner;        // { handle to owner WE instance }
  535.     long objectRefCon;            // { free for use by object handlers }
  536. } WEObjectDesc, *WEObjectDescPtr, **WEObjectDescHandle, **WEObjectReference;
  537.  
  538. // { A WESoup record is a static description of an object embedded in the text. }
  539. // { The 'SOUP' data type is just a collection of WESoup records, each followed }
  540. // { by the corresponding object data. }
  541. // { This data type complements the standard TEXT/styl pair. }
  542.  
  543. typedef struct WESoup {
  544.     long soupOffset;            // { insertion offset for this object }
  545.     OSType soupType;            // { 4-letter tag identifying object type }
  546.     long soupReserved1;            // { reserved for future use; set to zero }
  547.     Size soupDataSize;            // { size of object data following this record }
  548.     Point soupSize;                // { object height and width, in pixels }
  549.     long soupReserved2;            // { reserved for future use; set to zero }
  550. } WESoup, *WESoupPtr, **WESoupHandle;
  551.  
  552. /*    callback prototypes */
  553.  
  554. typedef pascal Boolean (*WEClickLoopProcPtr)(WEHandle hWE);
  555. typedef pascal void (*WEScrollProcPtr)(WEHandle hWE);
  556. typedef pascal void (*WETSMPreUpdateProcPtr)(WEHandle hWE);
  557. typedef pascal void (*WETSMPostUpdateProcPtr)(WEHandle hWE,
  558.         long fixLength, long inputAreaStart, long inputAreaEnd,
  559.         long pinRangeStart, long pinRangeEnd);
  560. typedef pascal OSErr (*WETranslateDragProcPtr)(DragReference theDrag,
  561.         ItemReference theItem, FlavorType requestedType, Handle putDataHere);
  562. typedef pascal void (*WEDrawTextProcPtr)(Ptr pText, long textLength, Fixed slop,
  563.         JustStyleCode styleRunPosition, WEHandle hWE);
  564. typedef pascal long (*WEPixelToCharProcPtr)(Ptr pText, long textLength, Fixed slop,
  565.         Fixed *pixelWidth, char *edge, JustStyleCode styleRunPosition, Fixed hPos, WEHandle hWE);
  566. typedef pascal short (*WECharToPixelProcPtr)(Ptr pText, long textLength, Fixed slop,
  567.         long offset, short direction, JustStyleCode styleRunPosition, long hPos, WEHandle hWE);
  568. typedef pascal StyledLineBreakCode (*WELineBreakProcPtr)(Ptr pText, long textLength,
  569.         long textStart, long textEnd, Fixed *textWidth, long *textOffset, WEHandle hWE);
  570. typedef pascal void (*WEWordBreakProcPtr)(Ptr pText, short textLength, short offset,
  571.         char edge, OffsetTable breakOffsets, ScriptCode script, WEHandle hWE);
  572. typedef pascal short (*WECharByteProcPtr)(Ptr pText, short textOffset, ScriptCode script,
  573.         WEHandle hWE);
  574. typedef pascal short (*WECharTypeProcPtr)(Ptr pText, short textOffset, ScriptCode script, WEHandle hWE);
  575.  
  576. typedef pascal OSErr (*WENewObjectProcPtr)(Point *defaultObjectSize,
  577.         WEObjectReference objectRef);
  578. typedef pascal OSErr (*WEDisposeObjectProcPtr)(WEObjectReference objectRef);
  579. typedef pascal OSErr (*WEDrawObjectProcPtr)(const Rect *destRect,
  580.         WEObjectReference objectRef);
  581. typedef pascal Boolean (*WEClickObjectProcPtr)(Point hitPt, short modifiers, long clickTime,
  582.         WEObjectReference objectRef);
  583.  
  584.  
  585. /*    UPP proc info */
  586.  
  587. enum {
  588.     uppWEClickLoopProcInfo = kPascalStackBased
  589.         | RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))
  590.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(WEHandle /*hWE*/)))
  591. };
  592. enum {
  593.     uppWEScrollProcInfo = kPascalStackBased
  594.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(WEHandle /*hWE*/)))
  595. };
  596. enum {
  597.     uppWETSMPreUpdateProcInfo = kPascalStackBased
  598.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(WEHandle /*hWE*/)))
  599. };
  600. enum {
  601.     uppWETSMPostUpdateProcInfo = kPascalStackBased
  602.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(WEHandle /*hWE*/)))
  603.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(long /*fixLength*/)))
  604.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(long /*inputAreaStart*/)))
  605.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(long /*inputAreaEnd*/)))
  606.         | STACK_ROUTINE_PARAMETER(5,SIZE_CODE(sizeof(long /*pinRangeStart*/)))
  607.         | STACK_ROUTINE_PARAMETER(6,SIZE_CODE(sizeof(long /*pinRangeEnd*/)))
  608. };
  609. enum {
  610.     uppWETranslateDragProcInfo = kPascalStackBased
  611.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  612.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(DragReference /*theDrag*/)))
  613.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(ItemReference /*theItem*/)))
  614.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(FlavorType /*requestedType*/)))
  615.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(Handle /*putDataHere*/)))
  616. };
  617. enum {
  618.     uppWEDrawTextProcInfo = kPascalStackBased
  619.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Ptr /*pText*/)))
  620.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(long /*textLength*/)))
  621.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(Fixed /*slop*/)))
  622.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(JustStyleCode /*styleRunPosition*/)))
  623.         | STACK_ROUTINE_PARAMETER(5,SIZE_CODE(sizeof(WEHandle /*hWE*/)))
  624. };
  625. enum {
  626.     uppWEPixelToCharProcInfo = kPascalStackBased
  627.         | RESULT_SIZE(SIZE_CODE(sizeof(long)))
  628.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Ptr /*pText*/)))
  629.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(long /*textLength*/)))
  630.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(Fixed /*slop*/)))
  631.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(Fixed * /*pixelWidth*/)))
  632.         | STACK_ROUTINE_PARAMETER(5,SIZE_CODE(sizeof(char * /*edge*/)))
  633.         | STACK_ROUTINE_PARAMETER(6,SIZE_CODE(sizeof(JustStyleCode /*styleRunPosition*/)))
  634.         | STACK_ROUTINE_PARAMETER(7,SIZE_CODE(sizeof(Fixed /*hPos*/)))
  635.         | STACK_ROUTINE_PARAMETER(8,SIZE_CODE(sizeof(WEHandle /*hWE*/)))
  636. };
  637. enum {
  638.     uppWECharToPixelProcInfo = kPascalStackBased
  639.         | RESULT_SIZE(SIZE_CODE(sizeof(short)))
  640.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Ptr /*pText*/)))
  641.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(long /*textLength*/)))
  642.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(Fixed /*slop*/)))
  643.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(long /*offset*/)))
  644.         | STACK_ROUTINE_PARAMETER(5,SIZE_CODE(sizeof(short /*direction*/)))
  645.         | STACK_ROUTINE_PARAMETER(6,SIZE_CODE(sizeof(JustStyleCode /*styleRunPosition*/)))
  646.         | STACK_ROUTINE_PARAMETER(7,SIZE_CODE(sizeof(long /*hPos*/)))
  647.         | STACK_ROUTINE_PARAMETER(8,SIZE_CODE(sizeof(WEHandle /*hWE*/)))
  648. };
  649. enum {
  650.     uppWELineBreakProcInfo = kPascalStackBased
  651.         | RESULT_SIZE(SIZE_CODE(sizeof(StyledLineBreakCode )))
  652.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Ptr /*pText*/)))
  653.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(long /*textLength*/)))
  654.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(long /*textStart*/)))
  655.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(long /*textEnd*/)))
  656.         | STACK_ROUTINE_PARAMETER(5,SIZE_CODE(sizeof(Fixed * /*textWidth*/)))
  657.         | STACK_ROUTINE_PARAMETER(6,SIZE_CODE(sizeof(long * /*textOffset*/)))
  658.         | STACK_ROUTINE_PARAMETER(7,SIZE_CODE(sizeof(WEHandle /*hWE*/)))
  659. };
  660. enum {
  661.     uppWEWordBreakProcInfo = kPascalStackBased
  662.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Ptr /*pText*/)))
  663.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(short /*textLength*/)))
  664.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(short /*offset*/)))
  665.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(char /*edge*/)))
  666.         | STACK_ROUTINE_PARAMETER(5,SIZE_CODE(sizeof(OffsetTable * /*breakOffsets*/)))
  667.         | STACK_ROUTINE_PARAMETER(6,SIZE_CODE(sizeof(ScriptCode * /*script*/)))
  668.         | STACK_ROUTINE_PARAMETER(7,SIZE_CODE(sizeof(WEHandle /*hWE*/)))
  669. };
  670. enum {
  671.     uppWECharByteProcInfo = kPascalStackBased
  672.         | RESULT_SIZE(SIZE_CODE(sizeof(short )))
  673.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Ptr /*pText*/)))
  674.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(short /*textOffset*/)))
  675.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(ScriptCode * /*script*/)))
  676.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(WEHandle /*hWE*/)))
  677. };
  678. enum {
  679.     uppWECharTypeProcInfo = kPascalStackBased
  680.         | RESULT_SIZE(SIZE_CODE(sizeof(short )))
  681.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Ptr /*pText*/)))
  682.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(short /*textOffset*/)))
  683.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(ScriptCode * /*script*/)))
  684.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(WEHandle /*hWE*/)))
  685. };
  686.  
  687.  
  688. enum {
  689.     uppWENewObjectProcInfo = kPascalStackBased
  690.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  691.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Point * /*defaultObjectSize*/)))
  692.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(WEObjectReference /*objectRef*/)))
  693. };
  694. enum {
  695.     uppWEDisposeObjectProcInfo = kPascalStackBased
  696.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  697.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(WEObjectReference /*objectRef*/)))
  698. };
  699. enum {
  700.     uppWEDrawObjectProcInfo = kPascalStackBased
  701.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  702.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(const Rect * /*destRect*/)))
  703.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(WEObjectReference /*objectRef*/)))
  704. };
  705. enum {
  706.     uppWEClickObjectProcInfo = kPascalStackBased
  707.         | RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))
  708.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Point /*hitPt*/)))
  709.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(short /*modifiers*/)))
  710.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(long /*clickTime*/)))
  711.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(WEObjectReference /*objectRef*/)))
  712. };
  713.  
  714.  
  715. /*    UPPs, New≈Proc macros & Call≈Proc macros */
  716.  
  717. /*
  718.     NOTE:
  719.     For compatibility with the Pascal version, Call≈Proc macros take the form:
  720.  
  721.         CallFooProc(..., userRoutine)
  722.  
  723.     instead of:
  724.  
  725.         CallFooProc(userRoutine, ...)
  726.  
  727. */
  728.  
  729. #if GENERATINGCFM
  730.  
  731. typedef UniversalProcPtr WEClickLoopUPP;
  732. typedef UniversalProcPtr WEScrollUPP;
  733. typedef UniversalProcPtr WETSMPreUpdateUPP;
  734. typedef UniversalProcPtr WETSMPostUpdateUPP;
  735. typedef UniversalProcPtr WETranslateDragUPP;
  736. typedef UniversalProcPtr WEDrawTextUPP;
  737. typedef UniversalProcPtr WEPixelToCharUPP;
  738. typedef UniversalProcPtr WECharToPixelUPP;
  739. typedef UniversalProcPtr WELineBreakUPP;
  740. typedef UniversalProcPtr WEWordBreakUPP;
  741. typedef UniversalProcPtr WECharByteUPP;
  742. typedef UniversalProcPtr WECharTypeUPP;
  743. typedef UniversalProcPtr WENewObjectUPP;
  744. typedef UniversalProcPtr WEDisposeObjectUPP;
  745. typedef UniversalProcPtr WEDrawObjectUPP;
  746. typedef UniversalProcPtr WEClickObjectUPP;
  747.  
  748. #define NewWEClickLoopProc(userRoutine) \
  749.     (WEClickLoopUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEClickLoopProcInfo, GetCurrentArchitecture())
  750. #define NewWEScrollProc(userRoutine) \
  751.     (WEScrollUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEScrollProcInfo, GetCurrentArchitecture())
  752. #define NewWETSMPreUpdateProc(userRoutine) \
  753.     (WETSMPreUpdateUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWETSMPreUpdateProcInfo, GetCurrentArchitecture())
  754. #define NewWETSMPostUpdateProc(userRoutine) \
  755.     (WETSMPostUpdateUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWETSMPostUpdateProcInfo, GetCurrentArchitecture())
  756. #define NewWETranslateDragProc(userRoutine) \
  757.     (WETranslateDragUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWETranslateDragProcInfo, GetCurrentArchitecture())
  758. #define NewWEDrawTextProc(userRoutine) \
  759.     (WEDrawTextUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEDrawTextProcInfo, GetCurrentArchitecture())
  760. #define NewWEPixelToCharProc(userRoutine) \
  761.     (WEPixelToCharUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEPixelToCharProcInfo, GetCurrentArchitecture())
  762. #define NewWECharToPixelProc(userRoutine) \
  763.     (WECharToPixelUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWECharToPixelProcInfo, GetCurrentArchitecture())
  764. #define NewWELineBreakProc(userRoutine) \
  765.     (WELineBreakUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWELineBreakProcInfo, GetCurrentArchitecture())
  766. #define NewWEWordBreakProc(userRoutine) \
  767.     (WEWordBreakUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEWordBreakProcInfo, GetCurrentArchitecture())
  768. #define NewWECharByteProc(userRoutine) \
  769.     (WECharByteUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWECharByteProcInfo, GetCurrentArchitecture())
  770. #define NewWECharTypeProc(userRoutine) \
  771.     (WECharTypeUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWECharTypeProcInfo, GetCurrentArchitecture())
  772. #define NewWENewObjectProc(userRoutine) \
  773.     (WENewObjectUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWENewObjectProcInfo, GetCurrentArchitecture())
  774. #define NewWEDisposeObjectProc(userRoutine) \
  775.     (WEDisposeObjectUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEDisposeObjectProcInfo, GetCurrentArchitecture())
  776. #define NewWEDrawObjectProc(userRoutine) \
  777.     (WEDrawObjectUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEDrawObjectProcInfo, GetCurrentArchitecture())
  778. #define NewWEClickObjectProc(userRoutine) \
  779.     (WEClickObjectUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEClickObjectProcInfo, GetCurrentArchitecture())
  780.  
  781. #define CallWEClickLoopProc(hWE, userRoutine) \
  782.     CallUniversalProc((userRoutine), uppWEClickLoopProcInfo, (hWE))
  783. #define CallWEScrollProc(hWE, userRoutine) \
  784.     CallUniversalProc((userRoutine), uppWEScrollProcInfo, (hWE))
  785. #define CallWETSMPreUpdateProc(hWE, userRoutine) \
  786.     CallUniversalProc((userRoutine), uppWETSMPreUpdateProcInfo, (hWE))
  787. #define CallWETSMPostUpdateProc(hWE, fixLength, inputAreaStart, inputAreaEnd, pinRangeStart, pinRangeEnd, userRoutine) \
  788.     CallUniversalProc((userRoutine), uppWETSMPostUpdateProcInfo, (hWE), (fixLength), (inputAreaStart), (inputAreaEnd), (pinRangeStart), (pinRangeEnd))
  789. #define CallWETranslateDragProc(theDrag, theItem, requestedType, putDataHere, userRoutine) \
  790.     CallUniversalProc((userRoutine), uppWETranslateDragProcInfo, (theDrag), (theItem), (requestedType), (putDataHere))
  791. #define CallWEDrawTextProc(pText, textLength, slop, styleRunPosition, hWE, userRoutine) \
  792.     CallUniversalProc((userRoutine), uppWEDrawTextProcInfo, (pText), (textLength), (slop), (styleRunPosition), (hWE))
  793. #define CallWEPixelToCharProc(pText, textLength, slop, pixelWidth, edge, styleRunPosition, hPos, hWE, userRoutine) \
  794.     CallUniversalProc((userRoutine), uppWEPixelToCharProcInfo, (pText), (textLength), (slop), (pixelWidth), (edge), (styleRunPosition), (hPos), (hWE))
  795. #define CallWECharToPixelProc(pText, textLength, slop, offset, direction, styleRunPosition, hPos, hWE, userRoutine) \
  796.     CallUniversalProc((userRoutine), uppWECharToPixelProcInfo, (pText), (textLength), (slop), (offset), (direction), (styleRunPosition), (hPos), (hWE))
  797. #define CallWELineBreakProc(pText, textLength, textStart, textEnd, textWidth, textOffset, hWE, userRoutine) \
  798.     CallUniversalProc((userRoutine), uppWELineBreakProcInfo, (pText), (textLength), (textStart), (textEnd), (textWidth), (textOffset), (hWE))
  799. #define CallWEWordBreakProc(pText, textLength, offset, edge, breakOffsets, script, hWE, userRoutine) \
  800.     CallUniversalProc((userRoutine), uppWEWordBreakProcInfo, (pText), (textLength), (offset), (edge), (breakOffsets), (script), (hWE))
  801. #define CallWECharByteProc(pText, textOffset, script, hWE, userRoutine) \
  802.     CallUniversalProc((userRoutine), uppWECharByteProcInfo, (pText), (textOffset), (script), (hWE))
  803. #define CallWECharTypeProc(pText, textOffset, script, hWE, userRoutine) \
  804.     CallUniversalProc((userRoutine), uppWECharTypeProcInfo, (pText), (textOffset), (script), (hWE))
  805. #define CallWENewObjectProc(defaultObjectSize, objectRef, userRoutine) \
  806.     CallUniversalProc((userRoutine), uppWENewObjectProcInfo, (defaultObjectSize), (objectRef))
  807. #define CallWEDisposeObjectProc(objectRef, userRoutine) \
  808.     CallUniversalProc((userRoutine), uppWEDisposeObjectProcInfo, (objectRef))
  809. #define CallWEDrawObjectProc(destRect, objectRef, userRoutine) \
  810.     CallUniversalProc((userRoutine), uppWEDrawObjectProcInfo, (destRect), (objectRef))
  811. #define CallWEClickObjectProc(hitPt, modifiers, clickTime, objectRef, userRoutine) \
  812.     CallUniversalProc((userRoutine), uppWEClickObjectProcInfo, (hitPt), (modifiers), (clickTime), (objectRef))
  813.  
  814. #else
  815.  
  816. typedef WEClickLoopProcPtr WEClickLoopUPP;
  817. typedef WEScrollProcPtr WEScrollUPP;
  818. typedef WETSMPreUpdateProcPtr WETSMPreUpdateUPP;
  819. typedef WETSMPostUpdateProcPtr WETSMPostUpdateUPP;
  820. typedef WETranslateDragProcPtr WETranslateDragUPP;
  821. typedef WEDrawTextProcPtr WEDrawTextUPP;
  822. typedef WEPixelToCharProcPtr WEPixelToCharUPP;
  823. typedef WECharToPixelProcPtr WECharToPixelUPP;
  824. typedef WELineBreakProcPtr WELineBreakUPP;
  825. typedef WEWordBreakProcPtr WEWordBreakUPP;
  826. typedef WECharByteProcPtr WECharByteUPP;
  827. typedef WECharTypeProcPtr WECharTypeUPP;
  828. typedef WENewObjectProcPtr WENewObjectUPP;
  829. typedef WEDisposeObjectProcPtr WEDisposeObjectUPP;
  830. typedef WEDrawObjectProcPtr WEDrawObjectUPP;
  831. typedef WEClickObjectProcPtr WEClickObjectUPP;
  832.  
  833. #define NewWEClickLoopProc(userRoutine) ((WEClickLoopUPP) (userRoutine))
  834. #define NewWEScrollProc(userRoutine) ((WEScrollUPP) (userRoutine))
  835. #define NewWETSMPreUpdateProc(userRoutine) ((WETSMPreUpdateUPP) (userRoutine))
  836. #define NewWETSMPostUpdateProc(userRoutine) ((WETSMPostUpdateUPP) (userRoutine))
  837. #define NewWETranslateDragProc(userRoutine) ((WETranslateDragUPP) (userRoutine))
  838. #define NewWEDrawTextProc(userRoutine) ((WEDrawTextUPP) (userRoutine))
  839. #define NewWEPixelToCharProc(userRoutine) ((WEPixelToCharUPP) (userRoutine))
  840. #define NewWECharToPixelProc(userRoutine) ((WECharToPixelUPP) (userRoutine))
  841. #define NewWELineBreakProc(userRoutine) ((WELineBreakUPP) (userRoutine))
  842. #define NewWEWordBreakProc(userRoutine) ((WEWordBreakUPP) (userRoutine))
  843. #define NewWECharByteProc(userRoutine) ((WECharByteUPP) (userRoutine))
  844. #define NewWECharTypeProc(userRoutine) ((WECharTypeUPP) (userRoutine))
  845. #define NewWENewObjectProc(userRoutine) ((WENewObjectUPP) (userRoutine))
  846. #define NewWEDisposeObjectProc(userRoutine) ((WEDisposeObjectUPP) (userRoutine))
  847. #define NewWEDrawObjectProc(userRoutine) ((WEDrawObjectUPP) (userRoutine))
  848. #define NewWEClickObjectProc(userRoutine) ((WEClickObjectUPP) (userRoutine))
  849.  
  850. #define CallWEClickLoopProc(hWE, userRoutine) \
  851.     (*(userRoutine))((hWE))
  852. #define CallWEScrollProc(hWE, userRoutine) \
  853.     (*(userRoutine))((hWE))
  854. #define CallWETSMPreUpdateProc(hWE, userRoutine) \
  855.     (*(userRoutine))((hWE))
  856. #define CallWETSMPostUpdateProc(hWE, fixLength, inputAreaStart, inputAreaEnd, pinRangeStart, pinRangeEnd, userRoutine) \
  857.     (*(userRoutine))((hWE), (fixLength), (inputAreaStart), (inputAreaEnd), (pinRangeStart), (pinRangeEnd))
  858. #define CallWETranslateDragProc(theDrag, theItem, requestedType, putDataHere, userRoutine) \
  859.     (*(userRoutine))((theDrag), (theItem), (requestedType), (putDataHere))
  860. #define CallWEDrawTextProc(pText, textLength, slop, styleRunPosition, hWE, userRoutine) \
  861.     (*(userRoutine))((pText), (textLength), (slop), (styleRunPosition), (hWE))
  862. #define CallWEPixelToCharProc(pText, textLength, slop, pixelWidth, edge, styleRunPosition, hPos, hWE, userRoutine) \
  863.     (*(userRoutine))((pText), (textLength), (slop), (pixelWidth), (edge), (styleRunPosition), (hPos), (hWE))
  864. #define CallWECharToPixelProc(pText, textLength, slop, offset, direction, styleRunPosition, hPos, hWE, userRoutine) \
  865.     (*(userRoutine))((pText), (textLength), (slop), (offset), (direction), (styleRunPosition), (hPos), (hWE))
  866. #define CallWELineBreakProc(pText, textLength, textStart, textEnd, textWidth, textOffset, hWE, userRoutine) \
  867.     (*(userRoutine))((pText), (textLength), (textStart), (textEnd), (textWidth), (textOffset), (hWE))
  868. #define CallWEWordBreakProc(pText, textLength, offset, edge, breakOffsets, script, hWE, userRoutine) \
  869.     (*(userRoutine))((pText), (textLength), (offset), (edge), (breakOffsets), (script), (hWE))
  870. #define CallWECharByteProc(pText, textOffset, script, hWE, userRoutine) \
  871.     (*(userRoutine))((pText), (textOffset), (script), (hWE))
  872. #define CallWECharTypeProc(pText, textOffset, script, hWE, userRoutine) \
  873.     (*(userRoutine))((pText), (textOffset), (script), (hWE))
  874. #define CallWENewObjectProc(defaultObjectSize, objectRef, userRoutine) \
  875.     (*(userRoutine))((defaultObjectSize), (objectRef))
  876. #define CallWEDisposeObjectProc(objectRef, userRoutine) \
  877.     (*(userRoutine))((objectRef))
  878. #define CallWEDrawObjectProc(destRect, objectRef, userRoutine) \
  879.     (*(userRoutine))((destRect), (objectRef))
  880. #define CallWEClickObjectProc(hitPt, modifiers, clickTime, objectRef, userRoutine) \
  881.     (*(userRoutine))((hitPt), (modifiers), (clickTime), (objectRef))
  882.  
  883. #endif
  884.  
  885. typedef Boolean (*SegmentLoopProcPtr)
  886.                 (LinePtr pLine,
  887.                  WERunAttributesPtr pAttrs,
  888.                  Ptr pSegment,
  889.                  long segmentStart,
  890.                  long segmentLength,
  891.                  JustStyleCode styleRunPosition,
  892.                  void *callbackData);
  893.  
  894. struct SLDrawData {
  895.     WEHandle hWE;
  896.     Rect bounds;                /* same rectangle, but in global coords */
  897.     Boolean usingColor;            /* true if drawing in color */
  898.     Boolean usingOffscreen;        /* true if an offscreen graphics world has been set up */
  899.     Boolean drawingOffscreen;    /* true if actually drawing to an offscreen buffer */
  900.     Boolean doErase;
  901.  
  902.     Rect lineRect;                // rect enclosing current line mf
  903.     Rect drawRect;                // visible portion of line rect mf
  904.     PixMapHandle offscreenPixels; // mf
  905.     GrafPtr screenPort;            // DWC 5/18/95
  906.     GDHandle screenDevice;
  907. };
  908.  
  909. struct SLCalcSlopData {
  910.     WEPtr pWE;
  911.     short lineWidth;
  912.     short totalSlop;
  913.     Fixed totalProportion;
  914. };
  915.  
  916. struct SLPixelToCharData {
  917.     WEHandle hWE;
  918.     Fixed hPos;
  919.     Fixed pixelWidth;
  920.     long offset;
  921.     char *edge;
  922. };
  923.  
  924. struct SLCharToPixelData {
  925.     WEHandle hWE;
  926.     long offset;
  927.     LongPt *thePoint;
  928. };
  929.  
  930. typedef struct WEFieldDescriptor {
  931.     short fOffset;
  932.     short fLength;
  933. } WEFieldDescriptor;
  934.  
  935. typedef struct WELookupTable {
  936.     OSType selector;
  937.     WEFieldDescriptor desc;
  938. } WELookupTable;
  939.  
  940. #if defined(powerc) || defined (__powerc)
  941. #pragma options align=reset
  942. #endif
  943.  
  944.  
  945. // Routines in WEUtilities.c
  946.  
  947. pascal void _WEForgetHandle(Handle *h);
  948. pascal Boolean _WESetHandleLock(Handle h, Boolean lock);
  949. pascal void _WEBlockClr(Ptr block, long blockSize);
  950. pascal Boolean _WEBlockCmp(Ptr block1, Ptr block2, long blockSize);
  951. pascal void _WEReorder(long *a, long *b);
  952. pascal OSErr _WEAllocate(Size blockSize, short allocFlags, Handle *h);
  953.  
  954. // in WEArrays.c
  955. pascal OSErr _WEInsertSlot(Handle h, Ptr element, long insertAt, long slotSize);
  956. pascal OSErr _WERemoveSlot(Handle h, long removeAt, long slotSize);
  957.  
  958. // in WEBirthDeath.c
  959. pascal OSErr _WERegisterWithTSM(WEHandle hWE);
  960. pascal void _WESetStandardHooks(WEHandle hWE);
  961. pascal OSErr WENew(LongRect *destRect, LongRect *viewRect, short flags, WEHandle *hWE);
  962. pascal void WEDispose(WEHandle hWE);
  963. pascal void _WEStdDrawText(Ptr pText, long textLength, Fixed slop, 
  964.                 JustStyleCode styleRunPosition, WEHandle hWE);
  965. pascal long _WEStdPixelToChar(Ptr pText, long textLength, Fixed slop,
  966.                 Fixed *width, char *edge, JustStyleCode styleRunPosition,
  967.                 Fixed hPos, WEHandle hWE);
  968. pascal short _WEStdCharToPixel(Ptr pText, long textLength, Fixed slop,
  969.                 long offset, short direction, JustStyleCode styleRunPosition,
  970.                 long hPos, WEHandle hWE);
  971. pascal StyledLineBreakCode _WEStdLineBreak(Ptr pText, long textLength,
  972.                 long textStart, long textEnd, Fixed *textWidth,
  973.                 long *textOffset, WEHandle hWE);
  974. pascal void _WEStdWordBreak(Ptr pText, short textLength, short offset,
  975.                 char edge, OffsetTable breakOffsets, ScriptCode script,
  976.                 WEHandle hWE);
  977. pascal short _WEStdCharByte(Ptr pText, short textLength, ScriptCode script,
  978.                 WEHandle hWE);
  979. pascal short _WEStdCharType(Ptr pText, short textLength, ScriptCode script,
  980.                 WEHandle hWE);
  981. pascal short _WEScriptToFont(ScriptCode script);
  982. pascal void _WEOldWordBreak(Ptr pText, short textLength, short offset,
  983.                 char edge, OffsetTable breakOffsets, ScriptCode script,
  984.                 WEHandle hWE);
  985. pascal short _WEOldCharByte(Ptr pText, short textLength, ScriptCode script,
  986.                 WEHandle hWE);
  987. pascal short _WEOldCharType(Ptr pText, short textLength, ScriptCode script,
  988.                 WEHandle hWE);
  989.  
  990. // in WEDebug.c
  991. pascal void _WEAssert(Boolean condition, StringPtr message);
  992. pascal void _WESanityCheck(WEHandle hWE);
  993.  
  994. // in WEInlineInput.c
  995. pascal OSErr _WEHiliteRangeArray(TextRangeArrayHandle hTray, WEHandle hWE);
  996. pascal OSErr _WEHandleUpdateActiveInputArea(AppleEvent *ae, AppleEvent *reply,
  997.         long handlerRefCon);
  998. pascal OSErr _WEHandlePositionToOffset(AppleEvent *ae, AppleEvent *reply,
  999.         long handlerRefCon);
  1000. pascal OSErr _WEHandleOffsetToPosition(AppleEvent *ae, AppleEvent *reply, long handlerRefCon);
  1001. pascal OSErr WEInstallTSMHandlers(void);
  1002. pascal OSErr WERemoveTSMHandlers(void);
  1003.  
  1004. // in WELongCoords.c
  1005. pascal long _WEPinInRange(long value, long rangeStart, long rangeEnd);
  1006. pascal void WELongPointToPoint(const LongPt *lp, Point *p);
  1007. pascal void WEPointToLongPoint(Point p, LongPt *lp);
  1008. pascal void WESetLongRect(LongRect *lr, long left, long top, long right, long bottom);
  1009. pascal void WELongRectToRect(const LongRect *lr, Rect *r);
  1010. pascal void WERectToLongRect(const Rect *r, LongRect *lr);
  1011. pascal void WEOffsetLongRect(LongRect *lr, long hOffset, long vOffset);
  1012. pascal Boolean WELongPointInLongRect(const LongPt *lp, const LongRect *lr);
  1013.  
  1014. // in WEDrawing.c
  1015. pascal long WEOffsetToLine (long offset, WEHandle hWE);
  1016. pascal long _WEPixelToLine(long vOffset, WEHandle hWE);
  1017. pascal long _WEOffsetToRun (long offset, WEHandle hWE);
  1018. pascal void _WEGetIndStyle(long runIndex, WERunInfo *info, WEHandle hWE);
  1019. pascal void WEGetRunInfo(long offset, WERunInfo *info, WEHandle hWE);
  1020. pascal OSErr WEGetSelectedObject(WEObjectDescHandle *hObjectDesc, WEHandle hWE);
  1021. pascal long WEFindNextObject(long offset, WEObjectDescHandle *hObjectDesc, WEHandle hWE);
  1022. pascal void _WEContinuousStyleRange(long rangeStart, long rangeEnd, short *mode,
  1023.         WETextStyle *ts, WEHandle hWE);
  1024. pascal void _WESynchNullStyle(WEHandle hWE);
  1025. pascal Boolean WEContinuousStyle (short *mode, TextStyle *ts, WEHandle hWE);
  1026. pascal void _WESegmentLoop(long firstLine, long lastLine, SegmentLoopProcPtr callback, void *callbackData,
  1027.         WEHandle hWE);
  1028. pascal void _WEDrawTSMHilite(Rect *segmentRect, short tsFlags);
  1029. pascal void _WEDrawLines (long firstLine, long lastLine, Boolean doErase, WEHandle hWE);
  1030. pascal short _WECalcPenIndent(short slop, short alignment);
  1031. pascal void _WESaveQDEnvironment(GrafPtr port, Boolean saveColor, QDEnvironment *theEnvironment);
  1032. pascal void _WERestoreQDEnvironment(QDEnvironment *theEnvironment);
  1033. pascal void _WEFillFontInfo (GrafPtr port, WERunAttributes *targetStyle);
  1034. pascal void _WECopyStyle (WETextStyle *sourceStyle, WETextStyle *targetStyle, short offStyles,
  1035.         short mode);
  1036. pascal Boolean _WEOffsetInRange(long offset, char edge, long rangeStart, long rangeEnd);
  1037.  
  1038. /*** in WELineLayout.c ***/
  1039. pascal void WEStopInlineSession(WEHandle hWE);
  1040. pascal OSErr _WERemoveLine(long lineIndex, WEPtr pWE);
  1041. pascal OSErr _WEInsertLine(long lineIndex, LineRec *theLine, WEPtr pWE);
  1042. pascal void _WEBumpOrigin(long lineIndex, long deltaOrigin, WEPtr pWE);
  1043. pascal long _WEFindLineBreak(long lineStart, WEHandle hWE);
  1044. pascal void _WECalcHeights(long rangeStart, long rangeEnd, short *lineAscent, short *lineDescent,
  1045.         WEHandle hWE);
  1046. pascal OSErr _WERecalBreaks(long *startLine, long *endLine, WEHandle hWE);
  1047. pascal void _WERecalSlops(long firstLine, long lastLine, WEHandle hWE);
  1048. pascal OSErr WECalText(WEHandle hWE);
  1049. pascal OSErr WEUseText(Handle text, WEHandle hWE);
  1050. pascal char WEGetAlignment(WEHandle hWE);
  1051. pascal void WEGetSelection(long *selStart, long *selEnd, WEHandle hWE);
  1052. pascal void WESetDestRect(LongRect *destRect, WEHandle hWE);
  1053. pascal void WEGetDestRect(LongRect *destRect, WEHandle hWE);
  1054. pascal void WESetViewRect(LongRect *viewRect, WEHandle hWE);
  1055. pascal void WEGetViewRect(LongRect *viewRect, WEHandle hWE);
  1056. pascal long WEGetTextLength(WEHandle hWE);
  1057. pascal long WECountLines(WEHandle hWE);
  1058. pascal long WEGetHeight(long startLine, long endLine, WEHandle hWE);
  1059. pascal Handle WEGetText(WEHandle hWE);
  1060. pascal char WEGetChar(long offset, WEHandle hWE);
  1061. pascal short WEFeatureFlag(short feature, short action, WEHandle hWE);
  1062.  
  1063. // WESelecting.c
  1064. pascal void _WEClearHiliteBit(void);
  1065. pascal long WEGetOffset(const LongPt *thePoint, char *edge, WEHandle hWE);
  1066. pascal void WEGetPoint(long offset, LongPt *thePoint, short *lineHeight, WEHandle hWE);
  1067. pascal void WEFindLine(long offset, char edge, long *lineStart, long *lineEnd, WEHandle hWE);
  1068. pascal long _WEGetLineStart(long lineNo, WEHandle hWE);
  1069. pascal short _WEGetContext(long offset, long *contextStart, long *contextEnd,
  1070.                         WEHandle hWE);
  1071. pascal short _WEGetRestrictedContext(long offset, long *contextStart, long *contextEnd,
  1072.                         WEHandle hWE);
  1073. pascal void WEFindWord(long offset, char edge, long *wordStart, long *wordEnd, WEHandle hWE);
  1074. pascal short WECharByte(long offset, WEHandle hWE);
  1075. pascal short WECharType(long offset, WEHandle hWE);
  1076. pascal void _WEDrawCaret(long offset, WEHandle hWE);
  1077. pascal void _WEBlinkCaret(WEHandle hWE);
  1078. pascal RgnHandle WEGetHiliteRgn(long rangeStart, long rangeEnd, WEHandle hWE);
  1079. pascal void _WEHiliteRange(long rangeStart, long rangeEnd, WEHandle hWE);
  1080. pascal void WESetSelection(long selStart, long selEnd, WEHandle hWE);
  1081. pascal void WESetAlignment(char alignment, WEHandle hWE);
  1082. pascal long _WEArrowOffset(short action, long offset, WEHandle hWE);
  1083. pascal void _WEDoArrowKey (short arrow, short modifiers, WEHandle hWE);
  1084. pascal Boolean WEAdjustCursor(Point mouseLoc, RgnHandle mouseRgn, WEHandle hWE);
  1085. pascal void WEIdle(long *maxSleep, WEHandle hWE);
  1086. pascal void WEUpdate(RgnHandle updateRgn, WEHandle hWE);
  1087. pascal void WEDeactivate(WEHandle hWE);
  1088. pascal void WEActivate(WEHandle hWE);
  1089. pascal Boolean WEIsActive(WEHandle hWE);
  1090. pascal void WEScroll(long hOffset, long vOffset, WEHandle hWE);
  1091. pascal Boolean _WEScrollIntoView (long offset, WEHandle hWE);
  1092. pascal void WESelView(WEHandle hWE);
  1093.  
  1094. // WELowLevelEditing.c
  1095. pascal Boolean _WEIsWordRange(long rangeStart, long rangeEnd, WEHandle hWE);
  1096. pascal Boolean _WEIsPunct(long offset, WEHandle hWE);
  1097. pascal void _WEIntelligentCut(long *rangeStart, long *rangeEnd, WEHandle hWE);
  1098. pascal short _WEIntelligentPaste(long rangeStart, long rangeEnd, WEHandle hWE);
  1099. pascal OSErr _WEInsertRun(long runIndex, long offset, long styleIndex, WEPtr pWE);
  1100. pascal OSErr _WERemoveRun(long runIndex, WEPtr pWE);
  1101. pascal void _WEChangeRun(long runIndex, long newStyleIndex, Boolean keepOld, WEPtr pWE);
  1102. pascal OSErr _WENewStyle(WERunAttributes *ts, long *styleIndex, WEPtr pWE);
  1103. pascal OSErr _WERedraw(long rangeStart, long rangeEnd, WEHandle hWE);
  1104. pascal OSErr _WESetStyleRange(long rangeStart, long rangeEnd, short mode, WETextStyle *ts, WEHandle hWE);
  1105. pascal OSErr _WEApplyStyleScrap(long rangeStart, long rangeEnd, StScrpHandle styleScrap, WEHandle hWE);
  1106. pascal OSErr _WEApplySoup(long offset, Handle hSoup, WEHandle hWE);
  1107. pascal void _WEBumpRunStart(long runIndex, long deltaRunStart, WEPtr pWE);
  1108. pascal OSErr _WERemoveRunRange(long rangeStart, long rangeEnd, WEHandle hWE);
  1109. pascal void _WEBumpLineStart(long lineIndex, long deltaLineStart, WEPtr pWE);
  1110. pascal OSErr _WERemoveLineRange(long rangeStart, long rangeEnd, WEHandle hWE);
  1111. pascal OSErr _WEDeleteRange(long rangeStart, long rangeEnd, WEHandle hWE);
  1112. pascal OSErr _WEInsertText(long offset, Ptr textPtr, long textLength, WEHandle hWE);
  1113.  
  1114. // WEHighLevelEditing.c
  1115. pascal WEActionHandle WEGetActionStack(WEHandle hWE);
  1116. pascal OSErr WEPushAction(WEActionHandle hAction);
  1117. pascal OSErr WENewAction(long rangeStart, long rangeEnd, long newTextLength,
  1118.                             WEActionKind actionKind, WEActionFlags actionFlags,
  1119.                             WEHandle hWE, WEActionHandle *hAction);
  1120. pascal void WEDisposeAction(WEActionHandle hAction);
  1121. pascal void WEForgetAction(WEActionHandle *hAction);
  1122. pascal OSErr WEDoAction(WEActionHandle hAction);
  1123. pascal OSErr WEUndo(WEHandle hWE);
  1124. pascal void WEClearUndo(WEHandle hWE);
  1125. pascal WEActionKind WEGetUndoInfo(Boolean *redoFlag, WEHandle hWE);
  1126. pascal long WEGetModCount(WEHandle hWE);
  1127. pascal void WEResetModCount(WEHandle hWE);
  1128. pascal void _WEAdjustUndoRange(long moreBytes, WEHandle hWE);
  1129. pascal OSErr _WETypeChar(char theByte, WEHandle hWE);
  1130. pascal OSErr _WEBackspace(WEHandle hWE);
  1131. pascal OSErr _WEForwardDelete(WEHandle hWE);
  1132. pascal Boolean WEIsTyping(WEHandle hWE);
  1133. pascal void WEKey(short key, short modifiers, WEHandle hWE);
  1134. pascal OSErr WEInsert(Ptr textPtr, long textLength, StScrpHandle hStyles, Handle hSoup, WEHandle hWE);
  1135. pascal OSErr WEInsertObject(OSType objectType, Handle objectDataHandle, Point objectSize, WEHandle hWE);
  1136. pascal OSErr WEDelete(WEHandle hWE);
  1137. pascal OSErr WECut(WEHandle hWE);
  1138. pascal Boolean WECanPaste(WEHandle hWE);
  1139. pascal OSErr WEPaste(WEHandle hWE);
  1140. pascal OSErr WESetStyle(short mode, TextStyle *ts, WEHandle hWE);
  1141. pascal OSErr WEUseStyleScrap(StScrpHandle hStyles, WEHandle hWE);
  1142.  
  1143. // WEMouse.c
  1144. pascal Boolean _WEIsOptionDrag(DragReference theDrag);
  1145. pascal OSErr _WEGetFlavor(DragReference theDrag, ItemReference theItem,
  1146.                 FlavorType requestedType, Handle hFlavor,
  1147.                 WETranslateDragUPP translateDragHook);
  1148. pascal OSErr _WEExtractFlavor(DragReference theDrag, ItemReference theItem,
  1149.                         FlavorType theType, Handle *hFlavor,
  1150.                         WETranslateDragUPP translateDragHook);
  1151. pascal Boolean WECanAcceptDrag(DragReference theDrag, WEHandle hWE);
  1152. pascal void _WEUpdateDragCaret(long offset, WEHandle hWE);
  1153. pascal OSErr WETrackDrag(DragTrackingMessage theMessage,DragReference theDrag,
  1154.                                     WEHandle hWE);
  1155. pascal OSErr WEReceiveDrag(DragReference theDrag, WEHandle hWE);
  1156. pascal OSErr _WESendFlavor(FlavorType theType, void *dragSendRefCon, Handle hWE,
  1157.                     DragReference theDrag);
  1158. pascal Boolean WEDraggedToTrash(DragReference theDrag);
  1159. pascal OSErr _WEDrag(Point mouseLoc, short modifiers, long clickTime, WEHandle hWE);
  1160. pascal void WEClick(Point mouseLoc, short modifiers, long clickTime, WEHandle hWE);
  1161.  
  1162. // WEObjects.c
  1163. pascal OSType WEGetObjectType(WEObjectDescHandle hObjectDesc);
  1164. pascal Handle WEGetObjectDataHandle(WEObjectDescHandle hObjectDesc);
  1165. pascal Point WEGetObjectSize(WEObjectDescHandle hObjectDesc);
  1166. pascal WEHandle WEGetObjectOwner(WEObjectDescHandle hObjectDesc);
  1167. pascal long WEGetObjectRefCon(WEObjectDescHandle hObjectDesc);
  1168. pascal void WESetObjectRefCon(WEObjectDescHandle hObjectDesc, long refCon);
  1169. pascal short _WELookupObjectType(OSType objectType, Handle hTable);
  1170. pascal OSErr _WEGetIndObjectType(short index, OSType *objectType, WEHandle hWE);
  1171. pascal OSErr _WENewObject(OSType objectType, Handle objectDataHandle, WEHandle hWE,
  1172.                     WEObjectDescHandle *hObjectDesc);
  1173. pascal OSErr _WEFreeObject(WEObjectDescHandle hObjectDesc);
  1174. pascal OSErr _WEDrawObject(WEObjectDescHandle hObjectDesc);
  1175. pascal Boolean _WEClickObject(Point hitPt, short modifiers, long clickTime,
  1176.                                 WEObjectDescHandle hObjectDesc);
  1177. pascal OSErr WEInstallObjectHandler(OSType objectType, OSType handlerSelector, UniversalProcPtr handler,
  1178.                 WEHandle hWE);
  1179.  
  1180. // WEScraps.c
  1181. pascal OSErr _WEPrependStyle(Handle hStyleScrap, WERunInfo *info, long offsetDelta);
  1182. pascal OSErr _WEAppendStyle(Handle hStyleScrap, WERunInfo *info, long offset);
  1183. pascal OSErr _WEPrependObject(Handle hSoup, WERunInfo *info, long offsetDelta);
  1184. pascal OSErr _WEAppendObject(Handle hSoup, WERunInfo *info, long offset);
  1185. pascal OSErr WECopyRange(long rangeStart, long rangeEnd, Handle hText, Handle
  1186.                     hStyles, Handle hSoup, WEHandle hWE);
  1187. pascal OSErr WECopy(WEHandle hWE);
  1188.  
  1189.  
  1190. /*** in WESelectors.c ***/
  1191. #define weUndefinedSelectorErr            -50 /* paramErr */
  1192.  
  1193. pascal void _WELookupSelector(WELookupTable *table, OSType selector, WEFieldDescriptor *desc);
  1194. pascal OSErr _WEGetField(WELookupTable *table, OSType selector, long *info, void *structure);
  1195. pascal OSErr _WESetField(WELookupTable *table, OSType selector, long *info, void *structure);
  1196. pascal OSErr WEGetInfo(OSType selector, void *info, WEHandle hWE);
  1197. pascal OSErr WESetInfo(OSType selector, const void *info, WEHandle hWE);
  1198. pascal OSErr _WESetHandler(OSType selector, long *info, void *structure);
  1199.  
  1200.  
  1201.